Skip to content

update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing #140999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented May 14, 2025

This is the replacement for just the part of #138163 dealing with the changed API of unescape functionality, since that got moved into its own crate.

This uses an unpublished version of literal-escaper (rust-lang/literal-escaper#8).

r? @nnethercote

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 14, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 16, 2025

☔ The latest upstream changes (presumably #141044) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 16, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 29, 2025

☔ The latest upstream changes (presumably #141595) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-cloud-vms rust-cloud-vms bot force-pushed the update-escaper branch 2 times, most recently from 97904bd to ba27e2d Compare June 13, 2025 09:59
@hkBst hkBst changed the title literal-escaper v0.0.2 => v0.0.3 for better API without unreachable update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing Jun 13, 2025
@rust-log-analyzer

This comment has been minimized.

@hkBst hkBst marked this pull request as ready for review June 13, 2025 12:35
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2025

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@GuillaumeGomez
Copy link
Member

Let's run a perf check then.

@bors try @rust-timer queue

@rust-log-analyzer

This comment has been minimized.

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 13, 2025
@bors
Copy link
Collaborator

bors commented Jun 13, 2025

⌛ Trying commit c15bc48 with merge 74c9a54...

bors added a commit that referenced this pull request Jun 13, 2025
update to literal-escaper 0.0.4 for better API without `unreachable` and faster string parsing

This is the replacement for just the part of #138163 dealing with the changed API of unescape functionality, since that got moved into its own crate.

This is a draft, because it uses an unpublished version of literal-escaper (rust-lang/literal-escaper#8). To test, clone literal-escaper into a folder next to rustc, and test rustc normally.

r? `@nnethercote`
@lnicola
Copy link
Member

lnicola commented Jun 13, 2025

Please file the rust-analyzer parts upstream once it's released, if possible.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 13, 2025

💔 Test failed - checks-actions

@rustbot rustbot added the A-tidy Area: The tidy tool label Jun 13, 2025
@hkBst hkBst changed the title update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing [DO NOT MERGE] update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing Jun 13, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Jun 13, 2025

☀️ Try build successful (CI)
Build commit: 8021674 (80216743568d271c50d695bcafdbdfc896378b2b, parent: c35911781925bcbfdeb5e6e1adb305097af46801)

@rust-timer

This comment has been minimized.

@hkBst
Copy link
Member Author

hkBst commented Jun 13, 2025

This works locally, but I'm confused about the CI failure, but try build success...

@GuillaumeGomez
Copy link
Member

Well, as long as the benches have been started, all good. :)

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8021674): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.3%] 4
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.6% [-1.2%, -0.1%] 17
All ❌✅ (primary) 0.2% [0.1%, 0.3%] 4

Max RSS (memory usage)

Results (primary -6.2%, secondary 2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
-6.2% [-6.2%, -6.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -6.2% [-6.2%, -6.2%] 1

Cycles

Results (secondary 0.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 755.253s -> 755.043s (-0.03%)
Artifact size: 372.23 MiB -> 372.28 MiB (0.01%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 13, 2025
@hkBst hkBst changed the title [DO NOT MERGE] update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing update to literal-escaper 0.0.4 for better API without unreachable and faster string parsing Jun 14, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@@ -89,3 +89,6 @@ codegen-units = 1
# FIXME: LTO cannot be enabled for binaries in a workspace
# <https://github.com/rust-lang/cargo/issues/9330>
# lto = true

[patch.crates-io]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but it may be nice to have anyway, like in src/tools/rust-analyzer/Cargo.toml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? If it's not in use it should not be there. You can leave a comment explaining what to use in case a similar situation happen in the future though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, should be dropped, but I'd prefer these parts to be filed as a PR in the rust-analyzer repo. I don't think it will cause issues except maybe a small, temporary, build slowdown (since it's compiling two versions).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make a difference if I comment out "[patch.crates-io]"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's fine but again: please add an explanation why this is kept around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an explanatory comment. Let me know if this is okay, or if I should remove the lot.

@hkBst
Copy link
Member Author

hkBst commented Jun 16, 2025

Please file the rust-analyzer parts upstream once it's released, if possible.

@lnicola While this is technically possible, I'm not sure how to transplant these changes efficiently. Is there maybe documentation for doing that? Or would it be possible for you to review here?

@lnicola
Copy link
Member

lnicola commented Jun 16, 2025

I'm not sure how to transplant these changes efficiently. Is there maybe documentation for doing that?

I downloaded https://github.com/rust-lang/rust/pull/140999.patch, deleted most of the changes, including the rust-analyzer Cargo.lock and Cargo.toml, applied it with git am and updated Cargo.toml manually since we bumped it to 0.0.3 in the meanwhile. I had to update the file paths (to remove src/tools/rust-analyzer/), but there was no need to change the file list at the top.

# If you want to use a crate with local modifications, you can set a path or git dependency here.
# For git dependencies, also add your source to ALLOWED_SOURCES in src/tools/tidy/src/extdeps.rs.
[patch.crates-io]
# rustc-literal-escaper = { path = '../literal-escaper/' }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can be removed now, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 96?

@lnicola
Copy link
Member

lnicola commented Jun 16, 2025

Given rust-lang/rust-analyzer#20012, can we drop the rust-analyzer parts?

@hkBst
Copy link
Member Author

hkBst commented Jun 16, 2025

Given rust-lang/rust-analyzer#20012, can we drop the rust-analyzer parts?

Now without rust-analyzer parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants